#include <iostream>
#include <string>
using  namespace std;
bool proverka(string skobky) {
  int count1 = 0, count2 = 0, count3 = 0, count4 = 0;
  for (char skobka : skobky) {
      if (skobka == '(') {
        count1++;
      } else if (skobka == ')') {
          count1--;
          if (count1 < 0) {
              return false;
          }
      } else if (skobka == '[') {
          count2++;
      } else if (skobka == ']') {
          count2--;
          if (count2 < 0) {
              return false;
          }
      } else if (skobka == '{') {
          count3++;
      } else if (skobka == '}') {
          count3--;
          if (count3 < 0) {
              return false;
          }
      } else if (skobka == '<') {
          count4++;
      } else if (skobka == '>') {
          count4--;
          if (count4 < 0) {
              return false;
          }
      } else {
          return false;
      }
  }
  return (count1 == 0) && (count2 == 0) && (count3 == 0) && (count4 == 0);
}

int main() {
  string a;
  string skobky;
  cin >> skobky;
  bool result = proverka(skobky);
  if (result == 0){
    a ="неверная";
  }
  if (result == 1){
  a ="верная";
  }
  cout << a << endl;
  return 0;
}

